import cn.sju.tq.Student;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

/**
 * Spring框架的核心功能之一：IoC（控制反转），把创建对象的工作交给Spring框架来完成
 * 软件编程的发展过程：   约定>配置>编码
 * SpringBoot   Spring+SpringMVC+MyBatis
 */

public class SpringIOCMain {
    public static void main(String[] args) {
        Student student = new Student();
        student.setId("12021051052");
        student.setName("汤佺");
        student.setAge(22);
        student.setGender((short) 1);
        System.out.println(student);
        //1.获取Spring容器
        ApplicationContext context = new ClassPathXmlApplicationContext("spring.xml");
        //2.有了容器后我们只要需要对象就从容器中拿
        Student stu2 = context.getBean(Student.class);
        System.out.println(stu2);
    }
}
